package itheima.zuoye.Test4;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Scanner;

public class Test1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日");

        System.out.println("请输入第一个人的生日（格式：yyyy年MM月dd日）：");
        String birthday1Str = scanner.nextLine();
        LocalDate birthday1 = LocalDate.parse(birthday1Str, formatter);

        System.out.println("请输入第二个人的生日（格式：yyyy年MM月dd日）：");
        String birthday2Str = scanner.nextLine();
        LocalDate birthday2 = LocalDate.parse(birthday2Str, formatter);

        if (birthday1.isBefore(birthday2)) {
            System.out.println("第一个人年龄更大。");
        } else if (birthday1.isAfter(birthday2)) {
            System.out.println("第二个人年龄更大。");
        } else {
            System.out.println("两人同龄。");
        }
    }
}
